# 错误：
nums = [20, 30, 30, 30, 40]
del_date = 30
for data in nums:
    if data == del_date:
        nums.remove(data)
print(nums)


# 逆序法：
nums = [20, 30, 30, 30, 40]
del_date = 30
for i in range(len(nums)-1, -1, -1):
    if nums[i] == del_date:
        nums.remove(data)
print(nums)


# 利用切片：
nums = [20, 30, 30, 30, 40]
del_date = 30
for data in nums[:]:
    if data == del_date:
        nums.remove(data)
print(nums)